import cn.net.xyan.blossom.kotlin.*
import com.wondersgroups.yypt.*
import org.junit.Test
import java.net.URL
import java.util.GregorianCalendar
import javax.xml.datatype.DatatypeFactory


class ScheduleServiceTest{

    @Test
    fun test1(){

        //val url = URL("http://localhost:8080/cxf/schedule?wsdl")
        val url = URL("http://192.168.203.90:8080/test/cxf/schedule?wsdl")
        val service = Schedule(url).scheduleControllerImplPort
        val gcal = GregorianCalendar()

        var deptReq = QueryScheduleDeptReq()

        deptReq.region =1
        //deptReq.registerTypeEx.add(1)
        deptReq.registerTypeEx.add(2)
        //deptReq.registerTypeEx.add(3)
       // deptReq.registerTypeEx.add(4)
        deptReq.registerTypeEx.add(5)
        deptReq.status = 1
        deptReq.vendor = "local"

        gcal.time = DateExt.today  //- DateDiff.Day * 10
        deptReq.startDate = DatatypeFactory.newInstance().newXMLGregorianCalendar(gcal)

        gcal.time = DateExt.tomorrow  //+ DateDiff.Day * 20
        deptReq.endDate = DatatypeFactory.newInstance().newXMLGregorianCalendar(gcal)

        println(deptReq.json)
        println(service.departments(deptReq).json)


     //   var queryArrangment =

       val localReq = LocalQueryScheduleReq()

        localReq.clinicDate = "2018-02-10"

        localReq.registerType = 5


        var rsp:Any?
        rsp = service.localQuerySchedules(localReq)

       // println(rsp?.json)

        var scheduleReq = QueryScheduleExpertReq()

        scheduleReq.deptCode = "205"
        scheduleReq.doctorNo = "PT205"
        scheduleReq.vendor = "local"
        scheduleReq.status = 1


        scheduleReq.startDate = deptReq.endDate
        scheduleReq.endDate = deptReq.endDate

       // rsp = service.queryExperts(scheduleReq)

        //println(rsp?.json)










    }
}